package com.sbtr.common.auto;

import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;

import java.util.List;

/**
 * 功能描述: mapper文件数据额外判断
 * @author dgl
 * @date 2020/12/1 13:56
 */
public class InstanceOfMethod implements TemplateMethodModelEx {

    @Override
    public Object exec(List list) throws TemplateModelException
    {
        if (list.size() != 1) {
            throw new TemplateModelException("Wrong arguments for method 'instanceOf'. Method has two required parameters: object and class");
        } else {
            return list.get(0).toString().equals("String");
        }
    }
}
